// electron-preload/index.ts
// import os from "os";
import { contextBridge, ipcRenderer } from "electron";

// const os = require("os");
// console.log("platform", os.platform());
// console.log(process.platform);

contextBridge.exposeInMainWorld("ipcRenderer", {
  ipcRenderer,
});

const getAllData = (msg: string) => {
  const allDatas = ipcRenderer.invoke("get-all-data", msg);
  return allDatas;
};
contextBridge.exposeInMainWorld("allDataAPI", {
  platform: process.platform,
  getAllData,
});

const choosePath = () => {
  ipcRenderer.invoke("choose-dir-path");
};
contextBridge.exposeInMainWorld("choosePath2Save", {
  choosePath,
});
